import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class xieru 
{
    static void xie(int n,String shuju,String dizhi) throws IOException 
    {
        String []p=new String[100];
        int j=0;
        int a=1;
        String fileName = dizhi;
        a=0;
        try (Scanner sl = new Scanner(new FileReader(fileName))) 
        {
            while (sl.hasNextLine()) 
            {  //按行读取字符串
                j=j+1;
                String lin = sl.nextLine();
                if(j!=n)
                {
                    p[j]=lin;
                }
                else
                {
                    p[j]=shuju;
                }
            }
        }
        catch (Exception e) {
            
        }
        if(a==0)
        {
            try (FileWriter xie = new FileWriter(fileName)) 
            {
                for(int l=1;l<=j;l++) 
                {
                    if(l==n)
                    {
                        xie.write(shuju+"\n");
                    }
                    else
                    {
                        xie.write(p[l]+"\n");
                    }
                }
            }
        }
    }
    static void zhuijia(String zifuchuan,String dizhi) throws IOException
    {
        try{
            File f=new File(dizhi);//向指定位置内写入
            FileOutputStream fout = new FileOutputStream(f,true);//追加写入

            fout.write(zifuchuan.getBytes());
            fout.write('\n');//换行
            fout.close();

        }catch(Exception e){

        }
    }
}
